package com.ttg.pojo;

//~--- non-JDK imports --------------------------------------------------------

import com.ttg.contants.TestContants;
import com.ttg.utils.DataUtil;

import java.util.ArrayList;
import java.util.List;

//~--- JDK imports ------------------------------------------------------------

//~--- classes ----------------------------------------------------------------

public class SyncInfoDTO<T> {

    /**
     * Field status
     * Description
     */
    private String status;

    /**
     * Field message
     * Description 
     */
    private String message;

    /**
     * Field flag
     * Description 
     */
    private boolean flag;

    /**
     * Field data
     * Description
     */
    private List<T> data;

    /**
     * Constructs SyncInfoDTO
     * Description
     */
    public SyncInfoDTO() {
        this.flag   = false;
        this.status = TestContants.SUCCESS;
    }

    /**
     * Method toString
     * Description
     * CreateDate 2015-11-30 15:10:25
     *
     * @return String
     */
    @Override
    public String toString() {
        return "SyncInfoDTO{" + "status='" + status + '\'' + ", message='" + message + '\'' + ", flag=" + flag
                + ", data=" + data + '}';
    }

    /**
     * Method getMessage
     * Description
     * CreateDate 2015-11-30 15:10:25
     *
     * @return String
     */
    public String getMessage() {
        return message;
    }

    /**
     * Method setMessage
     * Description
     * CreateDate 2015-11-30 15:10:25
     *
     * @param message String
     */
    public void setMessage(String message) {
        this.message = message;
        this.status  = TestContants.ERROR;
    }

    /**
     * Method isFlag
     * Description
     * CreateDate 2015-11-30 15:10:25
     *
     * @return boolean
     */
    public boolean isFlag() {
        return flag;
    }

    /**
     * Method setFlag
     * Description
     * CreateDate 2015-11-30 15:10:25
     *
     * @param flag boolean
     */
    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    /**
     * Method getStatus
     * Description
     *
     * @return String
     */
    public String getStatus() {
        return status;
    }

    /**
     * Method setStatus
     * Description
     *
     * @param status String
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * Method getData
     * Description
     *
     * @return List<T>
     */
    public List<T> getData() {
        return data;
    }

    /**
     * Method setData
     * Description
     *
     * @param data List<T>
     */
    public void setData(List<T> data) {

        if (!DataUtil.isEmpty (data)) {
            this.data = data;
            this.flag = true;
        }
    }

    /**
     * Method setData
     * Description
     *
     * @param data T
     */
    public void setData(T data) {
        if (!DataUtil.isEmpty (data)) {
            if (null == this.data) {
                this.data = new ArrayList<T>();
            }
            this.data.add(data);
            this.flag = true;
        }
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
